var e = getApp(), t = void 0;

Page({
    data: {
        mode: [ {
            label: "关闭接单",
            value: 0
        }, {
            label: "手动接单",
            value: 1
        }, {
            label: "自动接单",
            value: 2
        } ],
        modeFlag: 0
    },
    onLoad: function(e) {
        (t = this).setData({
            modeFlag: e.mode
        }), this.getTakeMode();
    },
    getTakeMode: function() {
        e.com.post("wx/config/takemode", {}, function(e) {
            0 == e.errno && t.setData({
                takemode: e.data.mode_type
            });
        });
    },
    modeChange: function(a) {
        wx.showLoading({
            title: "加载中",
            mask: !0
        }), e.com.post("wx/service/mode", {
            mode: this.data.mode[a.detail.value].value
        }, function(e) {
            wx.hideLoading(), 0 === e.errno && (wx.showToast({
                title: e.errmsg
            }), t.setData({
                modeFlag: a.detail.value
            }));
        }), 3 == this.data.takemode && wx.getLocation({
            type: "gcj02",
            success: function(t) {
                e.com.post("wx/user/updateLocation", {
                    latitude: t.latitude,
                    longitude: t.longitude
                }, function(e) {
                    e.errno;
                });
            }
        });
    }
});